package com.sentiment.listener;

import java.util.Date;
import java.util.Timer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import com.sentiment.listener.util.TimingSchedule;

/**
 * Application Lifecycle Listener implementation class HotKeywordListener
 *
 */
@WebListener
public class HotKeywordListener implements ServletContextListener {

    /**
     * Default constructor. 
     */
    public HotKeywordListener() {
        // TODO Auto-generated constructor stub
    }
    private Timer timer = null;
	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0)  { 
    	timer = new Timer(true);
    	timer.schedule(new TimingSchedule(),0,60*60*1000);  
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0)  { 
         timer.cancel();
    }
	
}
